import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by heyugui on 2017/4/19.
 * Description dubbo服务启动类
 */
public class DubboProvider {
    private static final Logger logger = LoggerFactory.getLogger(DubboProvider.class);

    public static void main(String[] args) {
        try{
            ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring.xml");
            logger.info("容器内容为{}",context);
            logger.info("是否包含bean[userInfoService],{}",context.containsBean("userInfoService"));
            context.start();
        }catch(Exception exception){
            logger.error("------启动dubbo服务失败");
        }
        synchronized (DubboProvider.class){
            while (true){
                try{
                    logger.info("服务已经启动!");
                    DubboProvider.class.wait();
                } catch (InterruptedException e) {
                    logger.error("同步报错！");
                }
            }
        }
    }
}
